home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Games / ms-0.07 / lib / work.h < prev   
Encoding:
C/C++ Source or Header  |  1995-06-27  |  1.6 KB  |  59 lines

  1. /* work.h - public definitions for work distribution module */
  2. /* Copyright (C) 1991-1993 Andreas Gustafsson */
  3.  
  4. /* **************** types **************** */
  5.  
  6. typedef struct wf_state wf_state;
  7.  
  8.  
  9. /* **************** public functions **************** */
  10.  
  11. /* 
  12.    wf=wf_init(timeout, pipe_mux, socket_mux): initialize the work
  13.    distribution system.  "timeout" should be well larger than the time
  14.    to complete a single work packet (in milliseconds).
  15.    The multiplexer "pipe_mux" is used for pipe input, 
  16.    "socket_mux" for socket input.
  17. */
  18. struct wf_state *wf_init();
  19.  
  20. /* wf_begin_dispatch(wf): prepare for a series of wf_dispatch_chunk calls */
  21. void wf_begin_dispatch();
  22.  
  23. /* wf_dispatch_chunk(wf, client, client_data, client_datalen, 
  24.      slave_data, slave_datalen): give a piece of work to the workforce */
  25. void wf_dispatch_chunk();
  26.  
  27. /* wf_restart(wf): make sure the computation servers are at work */
  28. void wf_restart();
  29.  
  30. /* wf_handle_socket_input(wf, client_data): call this when input available */
  31. void wf_handle_socket_input();
  32.  
  33. /* wf_timed_out(client_data): call when timeout has occurred */
  34. void wf_timed_out();
  35.  
  36. /* wf_client_died(): call when client no longer wants wf_draw() calls
  37.    despite outstanding requests */
  38. void wf_client_died();
  39.  
  40. /* wf_print_stats(wf): print statistics about server performance */
  41. void wf_print_stats();
  42.  
  43. /* wf_socket(wf): get the fd of the slave communications socket
  44.   (for select) */
  45. int wf_socket();
  46.  
  47. #ifndef OLD_TIMEOUT
  48. void wf_tick();
  49. #endif
  50.  
  51.  
  52. /* **** external functions called from work.c, user must define **** */
  53.  
  54. /* misc. services */
  55. void wf_error();    /* error reporting */
  56. void wf_warn();
  57.  
  58. void wf_draw();        /* callback */
  59.